{extend name='public/base'}
{block name="title"}
<title>下载app</title>
<meta name="keywords" content=""/>
<meta name="description" content=""/>
{/block}
{block name="css"}
<link rel="stylesheet" href="__CSS__/user.css?v2021925">
{/block}
{block name="header"}{/block}
{block name="style"}
<style>
</style>
{/block}
{block name="content"}
<div class="ect-wrapper user-app back">
    <!--    <p class="open-app ect-sub-btn"><a>打开APP</a></p>-->
    <p class="down-app ect-sub-btn"><a>立即下载</a></p>
    <div class="guide" onclick="closeOpenDiv(['.ect-mask','.guide'])"
         style="display: none; position: fixed; top: 0; right: 0; z-index: 99999;bottom: 0; text-align: right;">
        <img src="__IMAGE__/user/ad.jpg" style="width: 80%; margin-top: 15%; margin-right: 10%;">
    </div>
</div>
<div class="ect-mask" style="z-index: 99;opacity: .9;"></div>
<div class="confirm-box">
    <p class="title"></p>
    <p class="content">你可以下载或者打开APP查看详情</p>
    <ul>
        <li class="cancel-btn"><a onclick="closeOpenDiv(['.confirm-box','.ect-mask'])">好的</a></li>
        <li class="confirm-btn"><a href="/wechat/home">返回首页</a></li>
    </ul>
</div>
{/block}
{block name="footer"}{/block}
{block name="script"}
<script>
    $(function () {
        var height = $(window).height();
        var u = navigator.userAgent, app = navigator.appVersion;
        var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        var is_fair = "{$is_fair}";
        // if (!isAndroid) {
        //     $('.open-app').hide();
        // }
        $('.back').height(height);
        $('.back').on('click', '.downApp', function () {
            if (isIOS) {
                //location.href = 'itms-services://?action=download-manifest&url=https://demo.xindonglife.com/xindonglife/ExportOptions.plist';
                // location.href = 'https://apps.apple.com/app/id1587435440';
                layer.msg('苹果暂不支持下载');
            } else {
                //var url = 'https://download.xindonglife.com/xindong2.0/Xdsh_v1.1.0_release_2021-11-04-13-04-56_110_jiagu_sign.apk';
                // var url = 'https://download.xindonglife.com/ad_version/Xdsh_v1.1.2_release_2021-11-25-21-18-06_112_jiagu_sign.apk';
                var url = 'http://www.baidu.com'
                //download(url);
                location.href = url;
            }
        });

        $('.back').on('click', '.openApp', function () {
            var key = "{$k}", v = "{$v}", scheme = '';
            if (isIOS) {
                scheme = "xindonglifex://" + key + "/" + v;
            } else {
                scheme = "altai://" + key + "/" + v;
            }
            window.open(scheme);
        });

        function download(url) {
            var src = url;
            var form = document.createElement('form');
            form.action = src;
            document.getElementsByTagName('body')[0].appendChild(form);
            form.submit();
        }

        if (is_fair) {
            $('.down-app').addClass('downApp');
            $('.open-app').addClass('openApp');
        } else {
            $('.down-app').addClass('notice');
            $('.open-app').addClass('notice');
        }

        $('.back').on('click', '.notice', function () {
            openHideDiv([".ect-mask", ".guide"]);
        });

        var msg = "{$Request.param.msg}";
        if (msg) {
            $('.confirm-box .title').html(msg);
            openHideDiv(['.ect-mask', '.confirm-box']);
        }
    });
</script>
{/block}
{block name="share"}{/block}